/**
 * @author Andrey Anisimov <hercules@inbox.ru>
 */

import core.effect.easing.None;

class Back extends None {

    this.Back = function (s) {
        super();
        this.s = s || 1.70158;
    };

    this.easeIn = function (t, b, c, d) {
        return c * (t /= d) * t * ((this.s + 1) * t - this.s) + b;
    };

    this.easeOut = function (t, b, c, d) {
        return c * ((t = t / d - 1) * t * ((this.s + 1) * t + this.s) + 1) + b;
    };

    this.easeInOut = function (t, b, c, d) {
        if ((t /= d / 2) < 1) {
            return c / 2 * (t * t * (((this.s *= (1.525)) + 1) * t - this.s)) + b;
        } else {
            return c / 2 * ((t -= 2) * t * (((this.s *= (1.525)) + 1) * t + this.s) + 2) + b;
        }
    };
}